<!DOCTYPE html>
<%@page import="com.faeple.util.SessionManager"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ page language="java" contentType="text/html;  charset=utf-8" pageEncoding="utf-8"%>
<html lang="ko">
	<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	
	<title>${member.name}</title>
	
	<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
	<!--[if lt IE 9]>
		<script src="/resources/js/html5shiv.js"></script>
		<script src="/resources/js/respond.min.js"></script>
	<![endif]-->
	<link rel="stylesheet" href="/resources/css/font-awesome.css">
	<style type="text/css">
		body {
			color:#333;
		}
		.profileImage { width:40px; height: 40px; }
	</style>
</head>
<body>
<div class="container">
	<div class="col-md-8" style="padding:25px 0;">
		<form class="form-horizontal" role="form" id="member_form">
			<div class="form-group">
				<label class="col-sm-2 control-label">회원번호</label>
				<div class="col-sm-2">
					<input type="text" disabled="disabled" class="form-control" value="${member.idx}">
				</div>
			</div>
			<div class="form-group">
				<label for="email" class="col-sm-2 control-label">이메일</label>
				<div class="col-sm-5">
					<input type="text" class="form-control" id="email" name="email" placeholder="이메일" value="${member.email}">
				</div>
			</div>
			<div class="form-group">
				<label for="id" class="col-sm-2 control-label">아이디</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="id" name="id" placeholder="아이디" value="${member.id}">
				</div>
			</div>
			<div class="form-group">
				<label for="name" class="col-sm-2 control-label">이름</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="name" name="name" placeholder="아이디" value="${member.name}">
				</div>
			</div>
			<div class="form-group">
				<label for="gender" class="col-sm-2 control-label">성별</label>
				<label class="radio-inline" style="margin-left:15px;">
					<input type="radio" name="gender" id="gender" value="male"> 남성
				</label>
				<label class="radio-inline">
					<input type="radio" name="gender" id="gender" value="female"> 여성
				</label>
			</div>
			<div class="form-group">
				<label for="age1" class="col-sm-2 control-label">연령대</label>
				<div class="col-sm-2">
					<select class="form-control" id="age1" name="age1">
						<option value="0">연령대</option>
						<option value="1">10대</option>
						<option value="2">20대</option>
						<option value="3">30대</option>
						<option value="4">40대</option>
					</select>
				</div>
				<div class="col-sm-2">
					<select class="form-control" id="age2" name="age2">
						<option value="0">초반</option>
						<option value="1">중반</option>
						<option value="2">후반</option>
					</select>
				</div>
				<input type="hidden" id="profile_age" name="age" value="${userDto.age}">
			</div>
			<div class="form-group">
				<label for="description" class="col-sm-2 control-label">자기소개</label>
				<div class="col-sm-5">
					<textarea rows="3" class="form-control" id="description" name="description">${member.description}</textarea>
				</div>
			</div>
			<div class="form-group">
				<label for="website" class="col-sm-2 control-label">웹사이트</label>
				<div class="col-sm-5">
					<input type="text" class="form-control" id="website" name="website" placeholder="웹사이트" value="${member.website}">
				</div>
			</div>
			<%-- <div class="form-group">
				<label for="group" class="col-sm-2 control-label">그룹</label>
				<div class="col-sm-2">
					<input type="text" disabled="disabled" class="form-control" id="group" name="group" placeholder="그룹" value="${member.group_type}">
				</div>
			</div> --%>
			<div class="form-group">
				<label for="loginApp" class="col-sm-2 control-label">가입타입</label>
				<div class="col-sm-3">
					<input type="text" disabled="disabled" class="form-control" id="loginApp" name="loginApp" placeholder="가입타입" value="${member.loginApp}">
				</div>
			</div>
			<c:if test="${member.loginApp ne 'default'}">
				<div class="form-group">
					<label for="appidx" class="col-sm-2 control-label">SNS 고유번호</label>
					<div class="col-sm-3">
						<input type="text" disabled="disabled" class="form-control" id="appidx" name="appidx" placeholder="SNS 고유번호" value="${member.appIdx}">
					</div>
				</div>
			</c:if>
			<div class="form-group">
				<label for="loginApp" class="col-sm-2 control-label">모바일</label>
				<div class="col-sm-3">
					<c:if test="${member.android eq 1}"><img src="/resources/img/Android-icon.png" width="25" height="25" title="안드로이드 어플을 이용중입니다."></c:if>
				</div>
			</div>
			<div class="form-group">
				<label for="country" class="col-sm-2 control-label">국가</label>
				<div class="col-sm-3">
					<select class="form-control" id="country" name="country">
						<option value="0">대한민국</option>
						<option value="1">미국</option>
						<option value="2">중국</option>
						<option value="3">일본</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="location" class="col-sm-2 control-label">지역</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="location" name="location" placeholder="지역" value="${member.location}">
				</div>
			</div>
			<div class="form-group">
				<label for="layout_color" class="col-sm-2 control-label">레이아웃 색상</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="layout_color" name="layout_color" placeholder="레이아웃 색상" value="${member.layoutColor}">
				</div>
			</div>
			<div class="form-group">
				<label for="follow_accept" class="col-sm-2 control-label">팔로우 수락권한</label>
				<label class="radio-inline" style="margin-left:15px;">
					<input type="radio" name="follow_accept" id="follow_accept" value="2"> 모두
				</label>
				<label class="radio-inline">
					<input type="radio" name="follow_accept" id="follow_accept" value="1"> 선택
				</label>
				<label class="radio-inline">
					<input type="radio" name="follow_accept" id="follow_accept" value="0"> 비공개
				</label>
			</div>
			<div class="form-group">
				<label for="privacy" class="col-sm-2 control-label">프로필 공개범위</label>
				<label class="radio-inline" style="margin-left:15px;">
					<input type="radio" name="privacy" id="privacy" value="2"> 모두
				</label>
				<label class="radio-inline">
					<input type="radio" name="privacy" id="privacy" value="1"> 팔로워만
				</label>
				<label class="radio-inline">
					<input type="radio" name="privacy" id="privacy" value="0"> 비공개
				</label>
			</div>
			<div class="form-group">
				<label for="link_facebook" class="col-sm-2 control-label">페이스북 링크</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="link_facebook" name="link_facebook" placeholder="페이스북 링크" value="${member.link_facebook}">
				</div>
			</div>
			<div class="form-group">
				<label for="link_instagram" class="col-sm-2 control-label">인스타그램 링크</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="link_instagram" name="link_instagram" placeholder="인스타그램 링크" value="${member.link_instagram}">
				</div>
			</div>
			<div class="form-group">
				<label for="link_twitter" class="col-sm-2 control-label">트위터 링크</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="link_twitter" name="link_twitter" placeholder="트위터 링크" value="${member.link_twitter}">
				</div>
			</div>
			<div style="text-align:center;">
				<button type="button" class="btn btn-success" onclick="save()">저장</button>
				<button type="button" class="btn btn-danger" onclick="del()">삭제</button>
			</div>
		</form>
	</div>
</div>
</body>
<script src="/resources/js/jquery-1.11.0.js"></script>
<script src="/resources/js/jquery-ui-1.10.4.custom.min.js"></script>
<script src="/resources/js/bootstrap.js"></script>
<script type="text/javascript">
	//alert('${member.android}');
	$(function(){
		//성별체크
		if('${member.gender}' == "female"){
			$("input:radio[name='gender'][value='female']").attr("checked",true);
		}else{
			$("input:radio[name='gender'][value='male']").attr("checked",true);
		}
		//나이체크
		var ageinit1 = "${member.age}".substring(0,1);
   		if(ageinit1 != 0){
   			var ageinit2 = "${member.age}".substring(1,2);
   			if(ageinit1 == 1){
   	   			$("#age1 option:eq(1)").attr("selected", "selected");
   	   		}else if(ageinit1 == 2){
   	   			$("#age1 option:eq(2)").attr("selected", "selected");
   	   		}else if(ageinit1 == 3){
   	   			$("#age1 option:eq(3)").attr("selected", "selected");
   	   		}else{
   	   			$("#age1 option:eq(4)").attr("selected", "selected");
   	   		}
   			if(ageinit2 == 0){
   				$("#age2 option:eq(0)").attr("selected", "selected");
   			}else if(ageinit2 == 1){
   				$("#age2 option:eq(1)").attr("selected", "selected");
   			}else{
   				$("#age2 option:eq(2)").attr("selected", "selected");
   			}
   		}
	});
	
	function save(){
		
	}
	
	function del(){
		if(confirm("정말로 삭제하시겠습니까?")){
			$.ajax({
	   			type : "get"
			    , url : "/config/admin/memberDelete?idx="+'${member.idx}'
			    , dataType : "text"
			    , timeout : 5000
			    , error : function(){
			    	alert("다시 시도해 주세요");
			    }
			    , success : function(response) {
			    	if(response == "execute"){
			    		alert("삭제되었습니다");
			    		window.close();
			    	}else{
			    		alert("다시 시도해 주세요");
			    	}
			    }
			});
		}
	}
</script>
</html>